from PyQt5 import QtCore, QtGui, QtWidgets
import requests
import threading
# from bs4 import BeautifulSoup
import time
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox as xingxikuang


class Ui_MainWindow(object):

    def app_quit(self):
        '''
        退出游戏
        '''
        sys.exit(app.quit())

    def login(self, username, password):
        '''
        此段程序用于登录魔兽后台，成功则返回cookies，否则返回空
        '''
        global login_cookie
        login_url = f'http://{server_ip}/main/CheckLogin.asp?forward=index.asp'
        login_layout = {'name': username, 'password': password}
        login_headers = {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Origin': f'http://{server_ip}',
            'Referer': f'http://{server_ip}/',
            'Upgrade-Insecure-Requests': '1',
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36'
        }
        resp = requests.post(login_url, data=login_layout, headers=login_headers)
        resp.encoding = resp.apparent_encoding
        if resp.text == '<script language="JavaScript">window.location.href="index.asp";</script>':
            cookies = resp.cookies
            login_cookie = requests.utils.dict_from_cookiejar(cookies)
            # 登录成功，将大区、账号、密码锁定。
            self.lineEdit_zhanghao.setEnabled(False)
            self.lineEdit_mima.setEnabled(False)
            self.comboBox_daqu.setEnabled(False)
            self.groupBox_fight.setEnabled(True)
            self.groupBox_fight_info.setEnabled(True)
            self.groupBox_info.setEnabled(True)
            self.groupBox_bangdan.setEnabled(True)
            self.groupBox_gongneng.setEnabled(True)
            self.groupBox_zhangbei.setEnabled(True)
            # 返回登录后的cookie，用于后面战斗是提交cookie
            return login_cookie
        return ""

    def denglusingle(self):
        '''
        用户输入账号密后后，点击触发登录按扭
        '''
        try:
            # 获取文本框输入的文本（账号，密码），提交到login函数处理登录，并或者返回的cookie
            username = self.lineEdit_zhanghao.text()
            password = self.lineEdit_mima.text()
            cookie = self.login(username, password)
            # 将登录后的信息，传递给user_info用来处理用户信息显示
            self.user_info(cookie)
            return cookie
        except Exception as e:
            # print(e)
            xingxikuang.information(self.pushButton_dengluyouxi, '警告', '账号密码错！')
            # QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '账号密码错！')

    def user_info(self, cookie):
        """
        获取用户信息，并显示到指定的位置
        """
        resp = requests.get(f'http://{server_ip}/main/1_json.asp', cookies=cookie)
        resp.encoding = resp.apparent_encoding
        # # print(resp2.json())
        # self.user_info(resp2.json())
        info = resp.json()
        self.label_dengji.setText(str(info['Lv']))
        self.label_huiyuan.setText(str(info['VIP']))
        self.label_liliang.setText(str(info['LL']))
        self.label_naili.setText(str(info['NL']))
        self.label_minjie.setText(str(info['MJ']))
        self.label_zhili.setText(str(info['ZL']))
        self.label_gongji.setText(str(info['GJ']))
        self.label_fangyu.setText(str(info['FY']))
        self.label_jingyan.setText(str(info['nextEXP']))
        self.label_shengming.setText(str(info['HP']))
        self.label_mofa.setText(str(info['MP']))

    def zhuanshengbang(self):
        """
        转生排行榜
        """

        try:
            global login_cookie
            resp = requests.get(f'http://{server_ip}/main/top_user1_json.asp?type=5', cookies=login_cookie)
            resp.encoding = resp.apparent_encoding
            resp = eval(resp.text.replace('\r\n', '').replace('<DIV class=quote></DIV>', ''))
            # print(resp)
            # 给列表添加数据，可以用insert
            self.list = []
            for i in resp:
                self.list.insert(10, i['mz'] + "~" + str(i['ZS']) + '转')
            # self.list = ['1','2','3','4']
            # self.list.insert(1,'a') ，其中（1，'a'）1是追加位置，后面是值
            # print(self.listView_bangdan)
            slm = QtCore.QStringListModel()
            slm.setStringList(self.list)
            self.listView_bangdan.setModel(slm)

        except:
            pass

    def dengjibang(self):
        """
        等级排行榜
        """
        try:
            global login_cookie
            resp = requests.get(f'http://{server_ip}/main/top_user1_json.asp?type=1', cookies=login_cookie)
            resp.encoding = resp.apparent_encoding
            resp = eval(resp.text.replace('\r\n', '').replace('<DIV class=quote></DIV>', ''))
            # print(resp)
            # 给列表添加数据，可以用insert
            self.list = []
            for i in resp:
                self.list.insert(10, i['mz'] + "~" + str(i['Lv']) + "级")
            # self.list = ['1','2','3','4']
            # self.list.insert(1,'a') ，其中（1，'a'）1是追加位置，后面是值
            # print(self.listView_bangdan)
            slm = QtCore.QStringListModel()
            slm.setStringList(self.list)
            self.listView_bangdan.setModel(slm)
        except:
            pass

    def tuhaobang(self):
        """
        肉点排行榜（土豪榜）
        """
        try:
            global login_cookie
            resp = requests.get(f'http://{server_ip}/main/top_user1_json.asp?type=2', cookies=login_cookie)
            resp.encoding = resp.apparent_encoding
            resp = eval(resp.text.replace('\r\n', '').replace('<DIV class=quote></DIV>', ''))
            # print(resp)
            # 给列表添加数据，可以用insert
            self.list = []
            for i in resp:
                self.list.insert(10, i['mz'] + "~" + str(i['rou']) + '肉点')
            # self.list = ['1','2','3','4']
            # self.list.insert(1,'a') ，其中（1，'a'）1是追加位置，后面是值
            # print(self.listView_bangdan)
            slm = QtCore.QStringListModel()
            slm.setStringList(self.list)
            self.listView_bangdan.setModel(slm)
        except:
            pass

    def Vipbang(self):
        """
        VIP排行榜
        """
        try:
            global login_cookie
            # 这里的type=7；服务器后台只定义了1~6的对应值，else定义的是其他，故这里用了7。
            # 如果要定义其他的榜单，需要在后台top_user_json.asp中，再定义一个else if。
            resp = requests.get(f'http://{server_ip}/main/top_user1_json.asp?type=7', cookies=login_cookie)
            resp.encoding = resp.apparent_encoding
            resp = eval(resp.text.replace('\r\n', '').replace('<DIV class=quote></DIV>', ''))
            # print(resp)
            # 给列表添加数据，可以用insert
            self.list = []
            for i in resp:
                self.list.insert(10, i['mz'] + "~VIP:" + str(i['VIP']) + '级')
            # self.list = ['1','2','3','4']
            # self.list.insert(1,'a') ，其中（1，'a'）1是追加位置，后面是值
            # print(self.listView_bangdan)
            slm = QtCore.QStringListModel()
            slm.setStringList(self.list)
            self.listView_bangdan.setModel(slm)
        except:
            pass

    def mapchoose(self, int):
        """
        地图选择器，将选中的
        """
        global mapid
        mapid = int
        return mapid

    def online_guaji(self):
        global guajibool
        if self.pushButton.text() == "开始挂机":
            self.pushButton.setText('停止挂机')
            self.comboBox.setEnabled(False)
            guajibool = True
            # 这里接入挂机线程,守护进程setDaemon(True)，当程序关闭后，会自动退出进程，否会程序关闭后，还在后台运行。
            fight = threading.Thread(target=self.loopguaji, args=(), name='loopguaji')
            fight.setDaemon(True)
            fight.start()

        else:
            # 这里强制结束线程
            guajibool = False
            self.comboBox.setEnabled(True)
            self.pushButton.setText('开始挂机')

    def loopguaji(self):
        """
        这里面写挂机代码
        1.获到mapid，选地图时已经有了全局变量
        2.提交mapid获得怪物并打打打
        """
        global guajibool
        global mapid
        global login_cookie
        global fight_cookie
        while guajibool:
            try:
                fight_cookie, gw_map_text = self.gw_cookie(mapid=mapid, cookie=login_cookie)
                resp_map_fight = requests.get(
                    f'http://{server_ip}/main/Fight/zhandousdfkjlious987324987234923_auto.asp', cookies=fight_cookie)
                resp_map_fight.encoding = resp_map_fight.apparent_encoding
                if resp_map_fight.text.find('战斗胜利') > 0:
                    # print(time.strftime("%H:%M:%S", time.localtime()) + " ~ win")
                    self.fight_label.setText("战斗结果：" + "\n" + time.strftime("%H:%M:%S", time.localtime()) + " ~ 嗯，赢了")
                    # 胜利刷新人物信息
                    self.user_info(login_cookie)
                elif resp_map_fight.text.find('战斗失败') > 0 or resp_map_fight.text.find('英雄当前HP为0，不能进行战斗') > 0:
                    # print('战斗失败！')
                    self.fight_label.setText(
                        "战斗结果：" + "\n" + time.strftime("%H:%M:%S", time.localtime()) + " ~ 哦豁，你还需要努力哦！")
                    cookie2, gw_map_text = self.gw_cookie(mapid=mapid, cookie=login_cookie)
                else:
                    # print('go on')
                    self.fight_label.setText(
                        "战斗结果：" + "\n" + time.strftime("%H:%M:%S", time.localtime()) + " ~ 我打，我打，我打！")

                time.sleep(1)
            except:
                pass

    def gw_cookie(self, mapid, cookie):
        try:
            resp_map_gw = requests.get(f'http://{server_ip}/main/Mapzd~a8/?id={mapid}', cookies=cookie)
            resp_map_gw.encoding = resp_map_gw.apparent_encoding
            cookies1 = resp_map_gw.cookies
            cookie1 = requests.utils.dict_from_cookiejar(cookies1)
            cookie2 = cookie.copy()
            cookie2.update(cookie1)
            return cookie2, resp_map_gw.text
        except:
            pass

    def bag_and_zb(self):
        """
        装备及背包按钮触发
        """
        global login_cookie
        if self.pushButton_20.text() == '查看装备':
            self.pushButton_20.setText('查看背包')
            self.viewbagzb(login_cookie)
        else:
            self.pushButton_20.setText('查看装备')
            self.viewbag(login_cookie)

    def viewbag(self, login_cookie):
        resp = requests.get(f'http://{server_ip}/main/bag_json.asp', cookies=login_cookie)
        resp.encoding = 'gb2312'
        resp = eval(resp.text.replace('\r\n', ''))
        # 给列表添加数据，可以用insert
        self.list1 = []
        for i in resp:
            self.list1.insert(0, i['mc'] + ',id:' + i['Bagid'] + ',数量：' + str(i['item_all_num']))
        # self.list = ['1','2','3','4']
        # self.list.insert(1,'a') ，其中（1，'a'）1是追加位置，后面是值
        # print(self.listView_zhuangbei)
        slm1 = QtCore.QStringListModel()
        slm1.setStringList(self.list1)
        self.listView_zhuangbei.setModel(slm1)

    def viewbagzb(self, login_cookie):
        pass

    def buyzhuansheng_1(self):
        """
        购买转生石
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=128&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyzhuansheng_10(self):
        """
        购买转生石
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=128&Number=10',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def onekeydiu(self):
        '''
        一键清空装备包
        '''
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/clearbagZB.asp', cookies=login_cookie)
        xingxikuang.information(self.pushButton_23, '提示', '除VIP及身上的装备外，都清空了！')

    def buygeluer1(self):
        """
        购买格鲁尔钥匙1个
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=177&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buygeluer10(self):
        """
        购买格鲁尔钥匙10个
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=177&Number=10',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyzhuaman1(self):
        """
        购买祖阿曼钥匙1个
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=178&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyzhuaman10(self):
        """
        购买祖阿曼钥匙10个
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=178&Number=10',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyvip1(self):
        """
        VIP1宝石购买
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=149&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        elif resp.text.find("肉点不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '肉点不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyvip2(self):
        """
        VIP2宝石购买
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=150&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        elif resp.text.find("肉点不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '肉点不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyvip3(self):
        """
        VIP3宝石购买
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=151&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        elif resp.text.find("肉点不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '肉点不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyvip4(self):
        """
        VIP4宝石购买
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=173&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        elif resp.text.find("肉点不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '肉点不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyvip5(self):
        """
        VIP4宝石购买
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=172&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        elif resp.text.find("肉点不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '肉点不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def buyhundunshi(self):
        """
        VIP4宝石购买
        """
        global login_cookie
        resp = requests.get(f'http://{server_ip}/main/shop/merchantrou.asp?action=buy&sellid=135&Number=1',
                            cookies=login_cookie)
        resp.encoding = 'gb2312'
        if resp.text.find("木头不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '木头不足，再去刷点三')
        elif resp.text.find("金钱不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '金币不足，再去刷点三')
        elif resp.text.find("肉点不足") > -1:
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '肉点不足，再去刷点三')
        else:
            print(resp.text)
            QtWidgets.QMessageBox.information(self.pushButton_dengluyouxi, '警告', '购买成功')

    def setupUi(self, MainWindow):
        # 主窗口
        MainWindow.setObjectName("MainWindow")
        # 主窗口大小
        MainWindow.resize(1366, 711)
        font = QtGui.QFont()
        font.setPointSize(13)
        MainWindow.setFont(font)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        # 分组框，login
        self.groupBox_login = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_login.setGeometry(QtCore.QRect(0, 0, 891, 68))
        self.groupBox_login.setObjectName("groupBox_login")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.groupBox_login)
        self.horizontalLayout.setObjectName("horizontalLayout")
        # 大区选择
        self.comboBox_daqu = QtWidgets.QComboBox(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.comboBox_daqu.setFont(font)
        self.comboBox_daqu.setObjectName("comboBox_daqu")
        self.comboBox_daqu.addItem("")
        self.comboBox_daqu.addItem("")
        self.comboBox_daqu.addItem("")
        self.comboBox_daqu.addItem("")
        self.horizontalLayout.addWidget(self.comboBox_daqu)
        # 账号标签
        self.label = QtWidgets.QLabel(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        # 账号输入框
        self.lineEdit_zhanghao = QtWidgets.QLineEdit(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.lineEdit_zhanghao.setFont(font)
        self.lineEdit_zhanghao.setObjectName("lineEdit_zhanghao")
        self.horizontalLayout.addWidget(self.lineEdit_zhanghao)
        # 设定一个默认填充，打包时需手动删险，放在这方便测试，免得每次启动都要输账号
        self.lineEdit_zhanghao.setText("ygktest")
        # 密码标签
        self.label_2 = QtWidgets.QLabel(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        # 密码输入框
        self.lineEdit_mima = QtWidgets.QLineEdit(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.lineEdit_mima.setFont(font)
        self.lineEdit_mima.setEchoMode(QtWidgets.QLineEdit.Password)
        self.lineEdit_mima.setObjectName("lineEdit_mima")
        self.horizontalLayout.addWidget(self.lineEdit_mima)
        # 设定默认密码
        self.lineEdit_mima.setText("ygktest")
        # 按钮，登录游戏
        self.pushButton_dengluyouxi = QtWidgets.QPushButton(self.groupBox_login)
        self.pushButton_dengluyouxi.clicked.connect(self.denglusingle)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.pushButton_dengluyouxi.setFont(font)
        self.pushButton_dengluyouxi.setObjectName("pushButton_dengluyouxi")
        self.horizontalLayout.addWidget(self.pushButton_dengluyouxi)
        # 注册账号按扭
        self.pushButton_zhuchezhanghao = QtWidgets.QPushButton(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.pushButton_zhuchezhanghao.setFont(font)
        self.pushButton_zhuchezhanghao.setObjectName("pushButton_zhuchezhanghao")
        self.horizontalLayout.addWidget(self.pushButton_zhuchezhanghao)
        # 退出游戏按钮
        self.pushButton_tuichuyouxi = QtWidgets.QPushButton(self.groupBox_login)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.pushButton_tuichuyouxi.setFont(font)
        self.pushButton_tuichuyouxi.setObjectName("pushButton_tuichuyouxi")
        self.horizontalLayout.addWidget(self.pushButton_tuichuyouxi)
        self.pushButton_tuichuyouxi.clicked.connect(self.app_quit)

        # 公告组
        self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_2.setGeometry(QtCore.QRect(10, 70, 881, 61))
        self.groupBox_2.setObjectName("groupBox_2")
        self.groupBox_gonggao = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_gonggao.setGeometry(QtCore.QRect(900, 0, 451, 131))
        self.groupBox_gonggao.setObjectName("groupBox_gonggao")
        self.groupBox_shuoming = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_shuoming.setGeometry(QtCore.QRect(900, 130, 451, 381))
        self.groupBox_shuoming.setObjectName("groupBox_shuoming")
        self.splitter_5 = QtWidgets.QSplitter(self.groupBox_shuoming)
        self.splitter_5.setGeometry(QtCore.QRect(20, 30, 411, 331))
        self.splitter_5.setOrientation(QtCore.Qt.Vertical)
        self.splitter_5.setObjectName("splitter_5")
        self.label_30 = QtWidgets.QLabel(self.splitter_5)
        self.label_30.setObjectName("label_30")
        self.label_42 = QtWidgets.QLabel(self.splitter_5)
        self.label_42.setObjectName("label_42")
        self.label_35 = QtWidgets.QLabel(self.splitter_5)
        self.label_35.setObjectName("label_35")
        self.label_41 = QtWidgets.QLabel(self.splitter_5)
        self.label_41.setObjectName("label_41")
        self.label_40 = QtWidgets.QLabel(self.splitter_5)
        self.label_40.setObjectName("label_40")
        self.label_39 = QtWidgets.QLabel(self.splitter_5)
        self.label_39.setObjectName("label_39")
        self.label_44 = QtWidgets.QLabel(self.splitter_5)
        self.label_44.setObjectName("label_44")
        self.label_43 = QtWidgets.QLabel(self.splitter_5)
        self.label_43.setObjectName("label_43")
        self.label_45 = QtWidgets.QLabel(self.splitter_5)
        self.label_45.setObjectName("label_45")
        self.groupBox_gongneng = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_gongneng.setGeometry(QtCore.QRect(640, 510, 711, 171))
        self.groupBox_gongneng.setObjectName("groupBox_gongneng")
        self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_gongneng)
        # 功能区暂停使用
        self.groupBox_gongneng.setEnabled(False)
        self.layoutWidget_2.setGeometry(QtCore.QRect(470, 20, 231, 151))
        self.layoutWidget_2.setObjectName("layoutWidget_2")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.layoutWidget_2)
        self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.pushButton_36 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_36.setObjectName("pushButton_36")
        self.gridLayout_4.addWidget(self.pushButton_36, 0, 0, 1, 1)
        self.pushButton_37 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_37.setObjectName("pushButton_37")
        self.gridLayout_4.addWidget(self.pushButton_37, 0, 1, 1, 1)
        self.pushButton_38 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_38.setObjectName("pushButton_38")
        self.gridLayout_4.addWidget(self.pushButton_38, 1, 0, 1, 1)
        self.pushButton_39 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_39.setObjectName("pushButton_39")
        self.gridLayout_4.addWidget(self.pushButton_39, 1, 1, 1, 1)
        self.pushButton_40 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_40.setObjectName("pushButton_40")
        self.gridLayout_4.addWidget(self.pushButton_40, 2, 0, 1, 1)
        self.pushButton_41 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_41.setObjectName("pushButton_41")
        self.gridLayout_4.addWidget(self.pushButton_41, 2, 1, 1, 1)
        self.pushButton_42 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_42.setObjectName("pushButton_42")
        self.gridLayout_4.addWidget(self.pushButton_42, 3, 0, 1, 1)
        self.pushButton_43 = QtWidgets.QPushButton(self.layoutWidget_2)
        self.pushButton_43.setObjectName("pushButton_43")
        self.gridLayout_4.addWidget(self.pushButton_43, 3, 1, 1, 1)
        self.layoutWidget = QtWidgets.QWidget(self.groupBox_gongneng)
        self.layoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 151))
        self.layoutWidget.setObjectName("layoutWidget")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.pushButton_20 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_20.setObjectName("pushButton_20")
        self.gridLayout_2.addWidget(self.pushButton_20, 0, 0, 1, 1)
        # 装备按钮触发
        self.pushButton_20.clicked.connect(self.bag_and_zb)
        self.pushButton_26 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_26.setObjectName("pushButton_26")
        self.gridLayout_2.addWidget(self.pushButton_26, 0, 1, 1, 1)
        self.pushButton_26.clicked.connect(self.buyzhuansheng_1)
        self.pushButton_22 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_22.setObjectName("pushButton_22")
        self.gridLayout_2.addWidget(self.pushButton_22, 1, 0, 1, 1)
        self.pushButton_25 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_25.setObjectName("pushButton_25")
        self.gridLayout_2.addWidget(self.pushButton_25, 1, 1, 1, 1)
        self.pushButton_25.clicked.connect(self.buyzhuansheng_10)
        self.pushButton_21 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_21.setObjectName("pushButton_21")
        self.gridLayout_2.addWidget(self.pushButton_21, 2, 0, 1, 1)
        # 购买格鲁尔副本钥匙1个
        self.pushButton_24 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_24.setObjectName("pushButton_24")
        self.gridLayout_2.addWidget(self.pushButton_24, 2, 1, 1, 1)
        self.pushButton_24.clicked.connect(self.buygeluer1)
        # 一件丢装备入口调用
        self.pushButton_23 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_23.setObjectName("pushButton_23")
        self.gridLayout_2.addWidget(self.pushButton_23, 3, 0, 1, 1)
        self.pushButton_23.clicked.connect(self.onekeydiu)
        # 购买格鲁尔钥匙10个
        self.pushButton_27 = QtWidgets.QPushButton(self.layoutWidget)
        self.pushButton_27.setObjectName("pushButton_27")
        self.gridLayout_2.addWidget(self.pushButton_27, 3, 1, 1, 1)
        self.pushButton_27
        self.pushButton_27.clicked.connect(self.buygeluer10)

        self.layoutWidget1 = QtWidgets.QWidget(self.groupBox_gongneng)
        self.layoutWidget1.setGeometry(QtCore.QRect(240, 20, 221, 151))
        self.layoutWidget1.setObjectName("layoutWidget1")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.layoutWidget1)
        self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_3.setObjectName("gridLayout_3")
        # 购买祖阿曼钥匙1个
        self.pushButton_31 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_31.setObjectName("pushButton_31")
        self.gridLayout_3.addWidget(self.pushButton_31, 0, 0, 1, 1)
        self.pushButton_31.clicked.connect(self.buyzhuaman1)

        # VIP3宝石按钮
        self.pushButton_34 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_34.setObjectName("pushButton_34")
        self.gridLayout_3.addWidget(self.pushButton_34, 0, 1, 1, 1)
        self.pushButton_34.clicked.connect(self.buyvip3)

        # 购买祖阿曼钥匙10个
        self.pushButton_28 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_28.setObjectName("pushButton_28")
        self.gridLayout_3.addWidget(self.pushButton_28, 1, 0, 1, 1)
        self.pushButton_28.clicked.connect(self.buyzhuaman10)

        # VIP4宝石按钮
        self.pushButton_33 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_33.setObjectName("pushButton_33")
        self.gridLayout_3.addWidget(self.pushButton_33, 1, 1, 1, 1)
        self.pushButton_33.clicked.connect(self.buyvip4)

        # VIP1宝石按钮
        self.pushButton_30 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_30.setObjectName("pushButton_30")
        self.gridLayout_3.addWidget(self.pushButton_30, 2, 0, 1, 1)
        self.pushButton_30.clicked.connect(self.buyvip1)

        # VIP5宝石按钮
        self.pushButton_35 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_35.setObjectName("pushButton_35")
        self.gridLayout_3.addWidget(self.pushButton_35, 2, 1, 1, 1)
        self.pushButton_35.clicked.connect(self.buyvip5)

        # VIP2宝石按钮
        self.pushButton_29 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_29.setObjectName("pushButton_29")
        self.gridLayout_3.addWidget(self.pushButton_29, 3, 0, 1, 1)
        self.pushButton_29.clicked.connect(self.buyvip2)
        # 混沌石，全属性25
        self.pushButton_32 = QtWidgets.QPushButton(self.layoutWidget1)
        self.pushButton_32.setObjectName("pushButton_32")
        self.gridLayout_3.addWidget(self.pushButton_32, 3, 1, 1, 1)
        self.pushButton_32.clicked.connect(self.buyhundunshi)

        self.groupBox_info = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_info.setGeometry(QtCore.QRect(10, 130, 421, 381))
        self.groupBox_info.setObjectName("groupBox_info")
        self.label_12 = QtWidgets.QLabel(self.groupBox_info)
        self.label_12.setGeometry(QtCore.QRect(10, 310, 93, 16))
        self.label_12.setObjectName("label_12")
        self.label_23 = QtWidgets.QLabel(self.groupBox_info)
        self.label_23.setGeometry(QtCore.QRect(212, 310, 93, 16))
        self.label_23.setObjectName("label_23")
        self.label_shengyushuxingdian = QtWidgets.QLabel(self.groupBox_info)
        self.label_shengyushuxingdian.setGeometry(QtCore.QRect(103, 310, 81, 20))
        self.label_shengyushuxingdian.setObjectName("label_shengyushuxingdian")
        self.label_shengyujinengdian = QtWidgets.QLabel(self.groupBox_info)
        self.label_shengyujinengdian.setGeometry(QtCore.QRect(314, 310, 71, 20))
        self.label_shengyujinengdian.setObjectName("label_shengyujinengdian")
        self.pushButton_jn1 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_jn1.setGeometry(QtCore.QRect(54, 351, 41, 25))
        self.pushButton_jn1.setObjectName("pushButton_jn1")
        self.pushButton_jn2 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_jn2.setGeometry(QtCore.QRect(160, 351, 41, 25))
        self.pushButton_jn2.setObjectName("pushButton_jn2")
        self.pushButton_jn3 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_jn3.setGeometry(QtCore.QRect(260, 351, 41, 25))
        self.pushButton_jn3.setObjectName("pushButton_jn3")
        self.pushButton_jn4 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_jn4.setGeometry(QtCore.QRect(360, 351, 41, 25))
        self.pushButton_jn4.setObjectName("pushButton_jn4")
        self.pushButton_12 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_12.setGeometry(QtCore.QRect(320, 204, 39, 21))
        self.pushButton_12.setObjectName("pushButton_12")
        self.pushButton_13 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_13.setGeometry(QtCore.QRect(320, 283, 39, 20))
        self.pushButton_13.setObjectName("pushButton_13")
        self.pushButton_14 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_14.setGeometry(QtCore.QRect(320, 257, 39, 20))
        self.pushButton_14.setObjectName("pushButton_14")
        self.pushButton_15 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_15.setGeometry(QtCore.QRect(320, 231, 39, 20))
        self.pushButton_15.setObjectName("pushButton_15")
        self.pushButton_16 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_16.setGeometry(QtCore.QRect(358, 256, 51, 20))
        self.pushButton_16.setObjectName("pushButton_16")
        self.pushButton_17 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_17.setGeometry(QtCore.QRect(358, 282, 51, 20))
        self.pushButton_17.setObjectName("pushButton_17")
        self.pushButton_18 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_18.setGeometry(QtCore.QRect(358, 203, 51, 21))
        self.pushButton_18.setObjectName("pushButton_18")
        self.pushButton_19 = QtWidgets.QPushButton(self.groupBox_info)
        self.pushButton_19.setGeometry(QtCore.QRect(358, 230, 51, 20))
        self.pushButton_19.setObjectName("pushButton_19")
        self.splitter = QtWidgets.QSplitter(self.groupBox_info)
        self.splitter.setGeometry(QtCore.QRect(10, 330, 401, 21))
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.label_14 = QtWidgets.QLabel(self.splitter)
        self.label_14.setObjectName("label_14")
        self.label_jineng1 = QtWidgets.QLabel(self.splitter)
        self.label_jineng1.setObjectName("label_jineng1")
        self.label_17 = QtWidgets.QLabel(self.splitter)
        self.label_17.setObjectName("label_17")
        self.label_jineng2 = QtWidgets.QLabel(self.splitter)
        self.label_jineng2.setObjectName("label_jineng2")
        self.label_21 = QtWidgets.QLabel(self.splitter)
        self.label_21.setObjectName("label_21")
        self.label_jineng3 = QtWidgets.QLabel(self.splitter)
        self.label_jineng3.setObjectName("label_jineng3")
        self.label_20 = QtWidgets.QLabel(self.splitter)
        self.label_20.setObjectName("label_20")
        self.label_jineng4 = QtWidgets.QLabel(self.splitter)
        self.label_jineng4.setObjectName("label_jineng4")
        self.splitter_2 = QtWidgets.QSplitter(self.groupBox_info)
        self.splitter_2.setGeometry(QtCore.QRect(62, 22, 251, 281))
        self.splitter_2.setOrientation(QtCore.Qt.Vertical)
        self.splitter_2.setObjectName("splitter_2")
        self.label_huiyuan = QtWidgets.QLabel(self.splitter_2)
        self.label_huiyuan.setFrameShape(QtWidgets.QFrame.Box)
        self.label_huiyuan.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_huiyuan.setObjectName("label_huiyuan")
        self.label_dengji = QtWidgets.QLabel(self.splitter_2)
        self.label_dengji.setFrameShape(QtWidgets.QFrame.Box)
        self.label_dengji.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_dengji.setObjectName("label_dengji")
        self.label_jingyan = QtWidgets.QLabel(self.splitter_2)
        self.label_jingyan.setFrameShape(QtWidgets.QFrame.Box)
        self.label_jingyan.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_jingyan.setObjectName("label_jingyan")
        self.label_shengming = QtWidgets.QLabel(self.splitter_2)
        self.label_shengming.setFrameShape(QtWidgets.QFrame.Box)
        self.label_shengming.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_shengming.setObjectName("label_shengming")
        self.label_mofa = QtWidgets.QLabel(self.splitter_2)
        self.label_mofa.setFrameShape(QtWidgets.QFrame.Box)
        self.label_mofa.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_mofa.setObjectName("label_mofa")
        self.label_gongji = QtWidgets.QLabel(self.splitter_2)
        self.label_gongji.setFrameShape(QtWidgets.QFrame.Box)
        self.label_gongji.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_gongji.setObjectName("label_gongji")
        self.label_fangyu = QtWidgets.QLabel(self.splitter_2)
        self.label_fangyu.setFrameShape(QtWidgets.QFrame.Box)
        self.label_fangyu.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_fangyu.setObjectName("label_fangyu")
        self.label_liliang = QtWidgets.QLabel(self.splitter_2)
        self.label_liliang.setFrameShape(QtWidgets.QFrame.Box)
        self.label_liliang.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_liliang.setObjectName("label_liliang")
        self.label_minjie = QtWidgets.QLabel(self.splitter_2)
        self.label_minjie.setFrameShape(QtWidgets.QFrame.Box)
        self.label_minjie.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_minjie.setObjectName("label_minjie")
        self.label_naili = QtWidgets.QLabel(self.splitter_2)
        self.label_naili.setFrameShape(QtWidgets.QFrame.Box)
        self.label_naili.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_naili.setObjectName("label_naili")
        self.label_zhili = QtWidgets.QLabel(self.splitter_2)
        self.label_zhili.setFrameShape(QtWidgets.QFrame.Box)
        self.label_zhili.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_zhili.setObjectName("label_zhili")
        self.splitter_3 = QtWidgets.QSplitter(self.groupBox_info)
        self.splitter_3.setGeometry(QtCore.QRect(10, 22, 31, 281))
        self.splitter_3.setOrientation(QtCore.Qt.Vertical)
        self.splitter_3.setObjectName("splitter_3")
        self.label_3 = QtWidgets.QLabel(self.splitter_3)
        self.label_3.setObjectName("label_3")
        self.label_13 = QtWidgets.QLabel(self.splitter_3)
        self.label_13.setObjectName("label_13")
        self.label_4 = QtWidgets.QLabel(self.splitter_3)
        self.label_4.setObjectName("label_4")
        self.label_6 = QtWidgets.QLabel(self.splitter_3)
        self.label_6.setObjectName("label_6")
        self.label_8 = QtWidgets.QLabel(self.splitter_3)
        self.label_8.setObjectName("label_8")
        self.label_5 = QtWidgets.QLabel(self.splitter_3)
        self.label_5.setObjectName("label_5")
        self.label_9 = QtWidgets.QLabel(self.splitter_3)
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.splitter_3)
        self.label_10.setObjectName("label_10")
        self.label_11 = QtWidgets.QLabel(self.splitter_3)
        self.label_11.setObjectName("label_11")
        self.label_7 = QtWidgets.QLabel(self.splitter_3)
        self.label_7.setObjectName("label_7")
        self.label_15 = QtWidgets.QLabel(self.splitter_3)
        self.label_15.setObjectName("label_15")
        self.groupBox_bangdan = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_bangdan.setGeometry(QtCore.QRect(440, 130, 191, 381))
        self.groupBox_bangdan.setObjectName("groupBox_bangdan")
        self.listView_bangdan = QtWidgets.QListView(self.groupBox_bangdan)
        self.listView_bangdan.setGeometry(QtCore.QRect(10, 20, 171, 281))
        self.listView_bangdan.setFrameShape(QtWidgets.QFrame.Box)
        self.listView_bangdan.setFrameShadow(QtWidgets.QFrame.Plain)
        self.listView_bangdan.setObjectName("listView_bangdan")
        self.listView_bangdan.setEnabled(False)
        self.layoutWidget2 = QtWidgets.QWidget(self.groupBox_bangdan)
        self.layoutWidget2.setGeometry(QtCore.QRect(10, 310, 168, 60))
        self.layoutWidget2.setObjectName("layoutWidget2")
        self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget2)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        # 转生排行傍按钮
        self.pushButton_zhuanshengbang = QtWidgets.QPushButton(self.layoutWidget2)
        self.pushButton_zhuanshengbang.setObjectName("pushButton_zhuanshengbang")
        self.gridLayout.addWidget(self.pushButton_zhuanshengbang, 0, 0, 1, 1)
        self.pushButton_zhuanshengbang.clicked.connect(self.zhuanshengbang)
        # 等级排行傍按钮
        self.pushButton_dengjibang = QtWidgets.QPushButton(self.layoutWidget2)
        self.pushButton_dengjibang.setObjectName("pushButton_dengjibang")
        self.pushButton_dengjibang.clicked.connect(self.dengjibang)
        self.gridLayout.addWidget(self.pushButton_dengjibang, 0, 1, 1, 1)
        # 土豪排行傍按钮，也就是肉点排行，充值得的
        self.pushButton_tuhaobang = QtWidgets.QPushButton(self.layoutWidget2)
        self.pushButton_tuhaobang.setObjectName("pushButton_tuhaobang")
        self.pushButton_tuhaobang.clicked.connect(self.tuhaobang)
        self.gridLayout.addWidget(self.pushButton_tuhaobang, 1, 0, 1, 1)
        # VIP榜单
        self.pushButton_VIPbang = QtWidgets.QPushButton(self.layoutWidget2)
        self.pushButton_VIPbang.setObjectName("pushButton_VIPbang")
        self.gridLayout.addWidget(self.pushButton_VIPbang, 1, 1, 1, 1)
        self.pushButton_VIPbang.clicked.connect(self.Vipbang)
        # 装备group开始
        self.groupBox_zhangbei = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_zhangbei.setGeometry(QtCore.QRect(640, 130, 251, 381))
        self.groupBox_zhangbei.setObjectName("groupBox_zhangbei")
        self.groupBox_zhangbei.setEnabled(False)
        self.listView_zhuangbei = QtWidgets.QListView(self.groupBox_zhangbei)
        self.listView_zhuangbei.setGeometry(QtCore.QRect(10, 20, 231, 281))
        self.listView_zhuangbei.setFrameShape(QtWidgets.QFrame.Box)
        self.listView_zhuangbei.setFrameShadow(QtWidgets.QFrame.Plain)
        self.listView_zhuangbei.setObjectName("listView_zhuangbei")
        self.groupBox_fight = QtWidgets.QGroupBox(self.centralwidget)
        self.groupBox_fight.setGeometry(QtCore.QRect(10, 510, 181, 171))
        self.groupBox_fight.setObjectName("groupBox_fight")
        # 战斗区域不可能，需登录后使用
        self.groupBox_fight.setEnabled(False)
        self.checkBox = QtWidgets.QCheckBox(self.groupBox_fight)
        self.checkBox.setGeometry(QtCore.QRect(10, 50, 85, 21))
        self.checkBox.setObjectName("checkBox")
        self.comboBox = QtWidgets.QComboBox(self.groupBox_fight)
        self.comboBox.setGeometry(QtCore.QRect(57, 21, 111, 22))
        self.comboBox.setObjectName("comboBox")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.label_16 = QtWidgets.QLabel(self.groupBox_fight)
        self.label_16.setGeometry(QtCore.QRect(10, 24, 40, 16))
        self.label_16.setObjectName("label_16")
        self.checkBox_2 = QtWidgets.QCheckBox(self.groupBox_fight)
        self.checkBox_2.setGeometry(QtCore.QRect(10, 80, 161, 21))
        self.checkBox_2.setObjectName("checkBox_2")
        self.pushButton = QtWidgets.QPushButton(self.groupBox_fight)
        self.pushButton.setGeometry(QtCore.QRect(40, 105, 80, 51))
        self.pushButton.setObjectName("pushButton")
        self.pushButton.clicked.connect(self.online_guaji)
        self.groupBox_fight_info = QtWidgets.QGroupBox(self.centralwidget)
        # 这里的四个坐标，分别是 横坐标，纵坐标，长，宽
        self.groupBox_fight_info.setGeometry(QtCore.QRect(200, 510, 231, 171))
        self.groupBox_fight_info.setObjectName("groupBox_fight_info")
        self.groupBox_fight_info.setEnabled(False)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1366, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "文字魔兽war3 群：148808563"))
        self.groupBox_login.setTitle(_translate("MainWindow", "Login"))
        self.comboBox_daqu.setItemText(0, _translate("MainWindow", "选择大区"))
        self.comboBox_daqu.setItemText(1, _translate("MainWindow", "1区"))
        self.comboBox_daqu.setItemText(2, _translate("MainWindow", "2区"))
        self.comboBox_daqu.setItemText(3, _translate("MainWindow", "3区"))
        self.label.setText(_translate("MainWindow", "账号："))
        self.label_2.setText(_translate("MainWindow", "密码："))
        self.pushButton_dengluyouxi.setText(_translate("MainWindow", "登录游戏"))
        self.pushButton_zhuchezhanghao.setText(_translate("MainWindow", "注册账号"))
        self.pushButton_tuichuyouxi.setText(_translate("MainWindow", "退出游戏"))
        self.groupBox_2.setTitle(_translate("MainWindow", "资产"))
        self.groupBox_gonggao.setTitle(_translate("MainWindow", "公告"))
        self.groupBox_shuoming.setTitle(_translate("MainWindow", "说明"))
        self.label_30.setText(_translate("MainWindow", "1、300级以上可转生，非VIP转生需脱掉所有装备才可以转生。"))
        self.label_42.setText(_translate("MainWindow", "2、开始挂机旁边的框框，填入转生石的ID，VIP就可以自动转生了"))
        self.label_35.setText(_translate("MainWindow", "3、技能加点，每次一点。第四技能需人物50级以后才可以加。"))
        self.label_41.setText(_translate("MainWindow", "4、加属性点，可以选择加一点，也可以选择全部加"))
        self.label_40.setText(_translate("MainWindow", "5、赞助可获得相应肉点及木头等，具体群里问。"))
        self.label_39.setText(_translate("MainWindow", "6、新开区，冲榜排行，转生第一名送VIP6和肉点等。"))
        self.label_44.setText(_translate("MainWindow", "7、VIP地图可以获得相应等级的VIP装备，终极套在VIP6地图，灭世装"))
        self.label_43.setText(_translate("MainWindow", "8、1-4档强化100%成功，5-10档机率成功，11档以上100%（需肉点）"))
        self.label_45.setText(_translate("MainWindow", "9、所有装备及VIP等级均可打怪获得，也可联系群主加快速度"))
        self.groupBox_gongneng.setTitle(_translate("MainWindow", "功能操作"))
        self.pushButton_36.setText(_translate("MainWindow", "打造防爆石板10"))
        self.pushButton_37.setText(_translate("MainWindow", "白金VIP装备(随)"))
        self.pushButton_38.setText(_translate("MainWindow", "青铜VIP装备(随)"))
        self.pushButton_39.setText(_translate("MainWindow", "钻石VIP装备(随)"))
        self.pushButton_40.setText(_translate("MainWindow", "白银VIP装备(随)"))
        self.pushButton_41.setText(_translate("MainWindow", "灭世VIP装备(随)"))
        self.pushButton_42.setText(_translate("MainWindow", "黄金VIP装备(随)"))
        self.pushButton_43.setText(_translate("MainWindow", "2022虎年套"))
        self.pushButton_20.setText(_translate("MainWindow", "查看装备"))
        self.pushButton_26.setText(_translate("MainWindow", "买转生石1个"))
        self.pushButton_22.setText(_translate("MainWindow", "穿选中装备"))
        self.pushButton_25.setText(_translate("MainWindow", "转生石10个"))
        self.pushButton_21.setText(_translate("MainWindow", "脱选中装备"))
        self.pushButton_24.setText(_translate("MainWindow", "格鲁尔钥匙1"))
        self.pushButton_23.setText(_translate("MainWindow", "一键丢装备"))
        self.pushButton_27.setText(_translate("MainWindow", "格鲁尔钥匙10"))
        self.pushButton_31.setText(_translate("MainWindow", "祖阿曼钥匙1"))
        self.pushButton_34.setText(_translate("MainWindow", "VIP3宝石"))
        self.pushButton_28.setText(_translate("MainWindow", "祖阿曼钥匙10"))
        self.pushButton_33.setText(_translate("MainWindow", "VIP4宝石"))
        self.pushButton_30.setText(_translate("MainWindow", "VIP1宝石"))
        self.pushButton_35.setText(_translate("MainWindow", "VIP5宝石"))
        self.pushButton_29.setText(_translate("MainWindow", "VIP2宝石"))
        self.pushButton_32.setText(_translate("MainWindow", "全属+25混沌石"))
        self.groupBox_info.setTitle(_translate("MainWindow", "信息"))
        self.groupBox_info.setEnabled(False)
        self.label_12.setText(_translate("MainWindow", "剩余属性点数："))
        self.label_23.setText(_translate("MainWindow", "剩余技能点数："))
        self.label_shengyushuxingdian.setText(_translate("MainWindow", "0"))
        self.label_shengyujinengdian.setText(_translate("MainWindow", "0"))
        self.pushButton_jn1.setText(_translate("MainWindow", "+"))
        self.pushButton_jn2.setText(_translate("MainWindow", "+"))
        self.pushButton_jn3.setText(_translate("MainWindow", "+"))
        self.pushButton_jn4.setText(_translate("MainWindow", "+"))
        self.pushButton_12.setText(_translate("MainWindow", "+1"))
        self.pushButton_13.setText(_translate("MainWindow", "+1"))
        self.pushButton_14.setText(_translate("MainWindow", "+1"))
        self.pushButton_15.setText(_translate("MainWindow", "+1"))
        self.pushButton_16.setText(_translate("MainWindow", "+ALL"))
        self.pushButton_17.setText(_translate("MainWindow", "+ALL"))
        self.pushButton_18.setText(_translate("MainWindow", "+ALL"))
        self.pushButton_19.setText(_translate("MainWindow", "+ALL"))
        self.label_14.setText(_translate("MainWindow", "技能1："))
        self.label_jineng1.setText(_translate("MainWindow", "0"))
        self.label_17.setText(_translate("MainWindow", "技能2："))
        self.label_jineng2.setText(_translate("MainWindow", "0"))
        self.label_21.setText(_translate("MainWindow", "技能3："))
        self.label_jineng3.setText(_translate("MainWindow", "0"))
        self.label_20.setText(_translate("MainWindow", "技能4："))
        self.label_jineng4.setText(_translate("MainWindow", "0"))
        self.label_huiyuan.setText(_translate("MainWindow", "0"))
        self.label_dengji.setText(_translate("MainWindow", "0"))
        self.label_jingyan.setText(_translate("MainWindow", "0"))
        self.label_shengming.setText(_translate("MainWindow", "0"))
        self.label_mofa.setText(_translate("MainWindow", "0"))
        self.label_gongji.setText(_translate("MainWindow", "0"))
        self.label_fangyu.setText(_translate("MainWindow", "0"))
        self.label_liliang.setText(_translate("MainWindow", "0"))
        self.label_minjie.setText(_translate("MainWindow", "0"))
        self.label_naili.setText(_translate("MainWindow", "0"))
        self.label_zhili.setText(_translate("MainWindow", "0"))
        self.label_3.setText(_translate("MainWindow", "会员："))
        self.label_13.setText(_translate("MainWindow", "等级："))
        self.label_4.setText(_translate("MainWindow", "经验："))
        self.label_6.setText(_translate("MainWindow", "生命："))
        self.label_8.setText(_translate("MainWindow", "魔法："))
        self.label_5.setText(_translate("MainWindow", "攻击："))
        self.label_9.setText(_translate("MainWindow", "防御："))
        self.label_10.setText(_translate("MainWindow", "力量："))
        self.label_11.setText(_translate("MainWindow", "敏捷："))
        self.label_7.setText(_translate("MainWindow", "耐力："))
        self.label_15.setText(_translate("MainWindow", "智力："))
        self.groupBox_bangdan.setTitle(_translate("MainWindow", "榜单"))
        self.groupBox_bangdan.setEnabled(False)
        self.pushButton_zhuanshengbang.setText(_translate("MainWindow", "转生榜"))
        self.pushButton_dengjibang.setText(_translate("MainWindow", "等级榜"))
        self.pushButton_tuhaobang.setText(_translate("MainWindow", "土豪榜"))
        self.pushButton_VIPbang.setText(_translate("MainWindow", "VIP榜"))
        self.groupBox_zhangbei.setTitle(_translate("MainWindow", "装备包（不要手抖，双击是丢掉）"))
        self.groupBox_fight.setTitle(_translate("MainWindow", "挂机设定"))
        self.checkBox.setText(_translate("MainWindow", "自动转生"))
        # 设置所有地图信息
        self.comboBox.setItemText(0, _translate("MainWindow", "请选择需要挂机的地图"))
        self.comboBox.setItemText(1, _translate("MainWindow", "1-提瑞斯法林地0-10"))
        self.comboBox.setItemText(2, _translate("MainWindow", "2-丧钟镇11-20"))
        self.comboBox.setItemText(3, _translate("MainWindow", "3-萨提纳尔21-31"))
        self.comboBox.setItemText(4, _translate("MainWindow", "4-阿斯特兰纳31-40"))
        self.comboBox.setItemText(5, _translate("MainWindow", "5-银针山谷41-50"))
        self.comboBox.setItemText(6, _translate("MainWindow", "6-兽人之地51-60"))
        self.comboBox.setItemText(7, _translate("MainWindow", "7-北方城堡61-70"))
        self.comboBox.setItemText(8, _translate("MainWindow", "8-安伯米尔71-80"))
        self.comboBox.setItemText(9, _translate("MainWindow", "9-奥丹姆81-90"))
        self.comboBox.setItemText(10, _translate("MainWindow", "10-时光之穴91-100"))
        self.comboBox.setItemText(11, _translate("MainWindow", "11-佐拉姆海岸100+"))
        self.comboBox.setItemText(12, _translate("MainWindow", "12-血色修道院120-140"))
        self.comboBox.setItemText(13, _translate("MainWindow", "13-格罗姆高地140-160"))
        self.comboBox.setItemText(14, _translate("MainWindow", "14-禁魔监狱160-180"))
        self.comboBox.setItemText(15, _translate("MainWindow", "15-毒蛇神殿180-200"))
        self.comboBox.setItemText(16, _translate("MainWindow", "16-暗影迷宫200-220"))
        self.comboBox.setItemText(17, _translate("MainWindow", "17-风暴要塞220-240"))
        self.comboBox.setItemText(18, _translate("MainWindow", "18-卡拉赞205+"))
        self.comboBox.setItemText(19, _translate("MainWindow", "19-VIP1地图"))
        self.comboBox.setItemText(20, _translate("MainWindow", "20-VIP2地图"))
        self.comboBox.setItemText(21, _translate("MainWindow", "21-VIP3地图"))
        self.comboBox.setItemText(22, _translate("MainWindow", "22-VIP4地图"))
        self.comboBox.setItemText(23, _translate("MainWindow", "23-VIP5地图"))
        self.comboBox.setItemText(24, _translate("MainWindow", "24-副本-格鲁尔巢穴"))
        self.comboBox.setItemText(25, _translate("MainWindow", "25-副本-太阳之井"))
        self.comboBox.setItemText(26, _translate("MainWindow", "26-副本-祖阿曼"))
        self.comboBox.setItemText(27, _translate("MainWindow", "27-VIP6地图"))
        # 下面这句的[int],是将选中项的数字"27"传递过去，[str]，则是将文本"27-VIP6地图"传递过去；
        # 例 ：(27, _translate("MainWindow", "27-VIP6地图"))
        self.comboBox.activated[int].connect(self.mapchoose)

        self.label_16.setText(_translate("MainWindow", "地图："))
        # 是否自动购买转生石，如果选中则在战斗中自动购买，实现边挂机边转生。
        self.checkBox_2.setText(_translate("MainWindow", "自动买转生石"))
        # 开始挂机文本设置
        self.pushButton.setText(_translate("MainWindow", "开始挂机"))

        # 战斗提示框，用于战斗过程中显示
        self.groupBox_fight_info.setTitle(_translate("MainWindow", "战斗信息"))
        self.fight_label = QtWidgets.QLabel(self.groupBox_fight_info)
        self.fight_label.setObjectName("fight_label")
        # self.horizontalLayout.addWidget(self.fight_label)
        self.fight_label.setText(_translate("MainWindow", "战斗结果显示区"))
        self.fight_label.resize(200, 150)


if __name__ == '__main__':
    server_ip = '121.5.73.195'
    login_cookie = ''
    fight_cookie = ''
    mapid = ''
    guajibool = True
    app = QApplication(sys.argv)
    MainWindow = QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
